/**
 * 
 */
package Library.filesystem;

import java.util.ArrayList;

/**
 * A collection of a set of properties, wrapped around available variable types
 * in the HSQLDB as of v1.8.0.
 * 
 * DataTypes:
 * http://hsqldb.org/doc/guide/ch09.html#datatypes-section
 * 
 * @author Hardeep
 */
public class properties {
	private ArrayList<String> props = new ArrayList<String>();
	
	/**
	 * Add a data type as defined by the valid data types available to an 
	 * HSQLDB table. The String type should be in the format of a single 
	 * columnDefiniton as defined by the HSQLDB documentation here:
	 * http://hsqldb.org/doc/guide/ch09.html#create_table-section
	 * 
	 * Only use this method if you know what you are doing!
	 * @param columnDefinition
	 */
	public void addUserDefined(String columnDefinition) {
		props.add(columnDefinition);
	}
	
	public void addObject(String name) {
		props.add(name + " OBJECT");
	}
	
	public void addVarBinary(String name, int length) {
		length = Math.min(length, Integer.MAX_VALUE);
		props.add(name + " VARBINARY(" + length + ")");
	}
	
	public void addBinary(String name) {
		props.add(name + " BINARY");
	}
	
	public void addBigInt(String name) {
		props.add(name + " BIGINT");
	}
	
	public void addSmallInt(String name) {
		props.add(name + " SMALLINT");
	}
	
	public void addTinyInt(String name) {
		props.add(name + " TINYINT");
	}
	
	public void addDecimal(String name) {
		props.add(name + " DECIMAL");
	}
	
	public void addBoolean(String name) {
		props.add(name + " BOOLEAN");
	}
	
	public void addTimeStamp(String name) {
		props.add(name + " TIMESTAMP");
	}
	
	public void addTime(String name) {
		props.add(name + " TIME");
	}
	
	public void addDate(String name) {
		props.add(name + " DATE");
	}
	
	public void addVarChar(String name, int length, boolean ignoreCase) {
		length = Math.min(length, Integer.MAX_VALUE);
		
		String c = "";
		if ( ignoreCase ) c = "_IGNORECASE";
		
		props.add(name + " VARCHAR" + c + "(" + length + ")");
	}
	
	public void addIndex(String name) {
		props.add(name + " INTEGER IDENTITY");
	}
	
	public void addDouble(String name) {
		props.add(name + " DOUBLE");
	}
	
	public void addInt(String name) {
		props.add(name + " INTEGER");
	}
}
